def getusername(req):
    if req.session.has_key('username'):
        username=str(req.session['username'])
        if len(username)>21:
            username=username[:18]+'...'
        return username
    return ''